---@class DarkStreetMineralItem : DSActorItem
local DarkStreetMineralItem = Class("DarkStreetMineralItem",DSActorItem)
function DarkStreetMineralItem:OnCreate(obj)
    DSActorItem.OnCreate(self,obj)
    self.ctrlBuff = self:GetController("BuffType")
    self.Text_BuffName = self:GetChild("Text_BuffName")
    self.Text_BuffNum = self:GetChild("Text_BuffNum")
end

---@param actor RedRob.Minerals
function DarkStreetMineralItem:Refresh(actor)
    if not actor then return end
    local buffList = actor:GetBuffList()
    if table.getn(buffList) == 0 then return end
    for k,v in pairs(buffList) do
        local cfg = dataTable.getDataTableByStringId("t_buff",v.buffId)
        if cfg then
            local attr = cfg.f_Atribute[1]
            local id = attr[1]
            local value = attr[2]
            self.Text_BuffName.text = getLanguage(cfg.f_BuffName)
            if id == EnumConst.FighterAttributeEnum.ATK_PER then
                self.ctrlBuff.selectedIndex = 0
            elseif id == EnumConst.FighterAttributeEnum.HP_PER then
                self.ctrlBuff.selectedIndex = 1
            else
                self.ctrlBuff.selectedIndex = 2
            end
            self.Text_BuffNum.text = logicMgr.EquipManager.GetAttrValue(id,value)
        end
        break
    end
end

return DarkStreetMineralItem